package parameter

import (
	"github.com/gogf/gf/v2/frame/g"
)

type MenuInfoRes struct {
	MenuId           uint           `json:"menuId" dc:"菜单ID"`
	MenuName         string         `json:"menuName" dc:"菜单名称"`
	MenuCode         string         `json:"menuCode" dc:"菜单编码"`
	ParentId         uint           `json:"parentId" dc:"父菜单ID"`
	Icon             string         `json:"icon" dc:"icon"`
	Href             string         `json:"href" dc:"href"`
	Target           string         `json:"target" dc:"target"`
	SortNum          uint           `json:"sortNum" dc:"排序"`
	Level            uint           `json:"level" dc:"层级"`
	Remark           string         `json:"remark" dc:"备注"`
	EnableStatus     uint           `json:"enableStatus" dc:"状态,1-有效，0-无效"`
	EnableStatusName string         `json:"enableStatusName" dc:"状态名称"`
	CreatedUserName  string         `json:"createdUserName" dc:"创建人"`
	CreatedTime      string         `json:"createdTime" dc:"创建时间"`
	UpdatedTime      string         `json:"updatedTime" dc:"修改时间"`
	UpdatedUserName  string         `json:"updatedUserName" dc:"修改人"`
	Children         []*MenuInfoRes `json:"child" description:"子节点"`
}

type ListMenuReq struct {
	g.Meta `path:"/list" method:"post"`
}

type ListMenuRes struct {
	Detail []*MenuInfoRes `json:"detail" description:"列表"`
}

type SaveMenuReq struct {
	g.Meta     `path:"/save" method:"post"`
	MenuId     uint   `json:"menuId" dc:"菜单ID"`
	MenuName   string `json:"menuName" v:"required#菜单名称必填" dc:"菜单名称"`
	MenuCode   string `json:"menuCode" v:"required#菜单编码必填" dc:"菜单编码"`
	ParentId   uint   `json:"parentId" dc:"父菜单ID"`
	Icon       string `json:"icon" dc:"icon"`
	Href       string `json:"href" dc:"href"`
	Target     string `json:"target" dc:"target"`
	SortNum    uint   `json:"sortNum" dc:"排序"`
	Remark     string `json:"remark" dc:"备注"`
	operatorId uint
	level      uint
}

func (s *SaveMenuReq) SetOperatorId(operatorId uint) {
	s.operatorId = operatorId
}
func (s *SaveMenuReq) GetOperatorId() uint {
	return s.operatorId
}
func (s *SaveMenuReq) SetLevel(level uint) {
	s.level = level
}
func (s *SaveMenuReq) GetLevel() uint {
	return s.level
}

type SaveMenuRes struct {
	MenuId uint `json:"menuId" dc:"用户ID"`
}
type CreateRootMenuReq struct {
	g.Meta     `path:"/create" method:"post"`
	MenuName   string `json:"menuName" v:"required#菜单名称必填" dc:"菜单名称"`
	MenuCode   string `json:"menuCode" v:"required#菜单编码必填" dc:"菜单编码"`
	operatorId uint
}

func (s *CreateRootMenuReq) SetOperatorId(operatorId uint) {
	s.operatorId = operatorId
}
func (s *CreateRootMenuReq) GetOperatorId() uint {
	return s.operatorId
}

type CreateRootMenuRes struct {
}
type DeleteMenuReq struct {
	g.Meta     `path:"/delete" method:"post"`
	MenuId     uint `json:"menuId" v:"required#菜单Id必填" dc:"菜单Id"`
	operatorId uint
}

func (s *DeleteMenuReq) SetOperatorId(operatorId uint) {
	s.operatorId = operatorId
}
func (s *DeleteMenuReq) GetOperatorId() uint {
	return s.operatorId
}

type DeleteMenuRes struct {
}
type GetPermissionReq struct {
	g.Meta `path:"/permission" method:"post"`
	RoleId uint `json:"roleId" description:"角色Id"`
}
type GetPermissionRes struct {
	Detail []*PermissionTreeRes `json:"detail" description:"结点"`
}
type PermissionTreeRes struct {
	Id        uint   `json:"id" description:"Id"`
	PId       uint   `json:"pId" description:"父Id"`
	Title     string `json:"title" description:"显示Label"`
	Remark    string `json:"remark" description:"备注"`
	Spread    bool   `json:"spread" description:"是否展开" d:"true"`
	Checked   bool   `json:"checked" description:"选中状态" d:"false"`
	AuthState uint
	Children  []*PermissionTreeRes `json:"children" description:"子节点"`
}
